|
|
|
|
|
|
|
If any of the field changes are incorrect, you would set the adStatus parameter to adStatusCancel. This would cancel the entire operation. |
|
|
|
|
|
|
|
|
The Data control's Error event is triggered only when an error occurs during an automated process, such as the following: |
|
|
|
 |
|
|
|
|
The Data control is loaded. |
|
|
|
 |
|
|
|
|
A navigation button is clicked. |
|
|
|
 |
|
|
|
|
The database specified in the DatabaseName property can't be found. |
|
|
|
|
|
|
|
|
When the event is triggered, several parameters are returned to help you resolve the underlying cause of the problem. These parameters are |
|
|
|
 |
|
|
|
|
Error NumberThe native error number |
|
|
|
 |
|
|
|
|
DescriptionText description of the above error number |
|
|
|
 |
|
|
|
|
ScodeThe error code that is returned by the database server |
|
|
|
 |
|
|
|
|
SourceThe source of the error |
|
|
|
|
|
|
|
|
If the CancelDisplay parameter is set to False, an attempt is made to continue with the next line of code. If the parameter is set to True (the default), an error message appears. When you write the code for the Error event, you can set the CancelDisplay parameter to False for those errors that can be corrected in your code, or to True for all the other errors that might occur. |
|
|
|
|
|
|
|
|
This event is triggered after the current record pointer is moved to another record. You can use this event to control the movement of related Data controls on a form. For example, if you're creating an order-entry display and select a new customer, you might want to change the recordset of the orders Data control by changing the RecordSource property and then invoking the Requery method for the second Data control. |
|
|
|
|
|
|
|
|
In addition to responding to events, the Data control also has several methods that you can use in your application code. Many of these methods are the same as the ones used with the ActiveX Data Objects, but you can use two unique ones: Requery and UpdateControls. |
|
|
|
|
|
|
|
|
The Requery method tells the Data control to requery the database by using the query in the RecordSource property. You would need to use the Requery method for several reasons: |
|
|
|
 |
|
|
|
|
When the Data control's RecordSource property is changed |
|
|
|
|
|